package com.yc.project.servlet;

import com.google.gson.Gson;
import com.yc.common.util.DBHelper;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@WebServlet(name = "QueryDishServlet", value = "/queryDish.s")
public class QueryDishServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String sql = "select * from gghc_dish limit 0,4";
        List<Map<String, Object>> list = DBHelper.selectListMap(sql);
        String json = new Gson().toJson(list);
        response.setContentType("application/json;charset=utf-8");
        response.getWriter().append(json);
    }


}
